/*
 * SliceRegister_gtest.h
 *
 *  Created on: Nov 26, 2012
 *      Author: Federico Orquera
 */

#ifndef SLICEREGISTER_GTEST_H_
#define SLICEREGISTER_GTEST_H_

#include <gtest/gtest.h>
#include <string>

#include "../logic_layer/SignatureSlicingIndexFile/SignatureRegister.h"

/**
 * Test Suite de la clase SignatureSlicingIndex
 */
namespace SignatureSlicingIndex
{

	class SignatureRegisterTestFixture: public ::testing::Test {
	public:
		std::string fileName;

		SignatureRegisterTestFixture():fileName("SignatureRegisterTestFile.tmp") {}
		virtual ~SignatureRegisterTestFixture() {}
		void SetUp() {}
		void TearDown() {}

	};

	/**
	 * Test Get
	 */

	TEST_F( SignatureRegisterTestFixture, RegisterGetSignature) {

		typedef SignatureRegister<4, PhraseID> Register;

		PhraseID 						ID1(1);
		std::bitset<4> 					Signature1(std::string("0001"));
		SignatureRegister<4, PhraseID> 	test1(ID1, Signature1);

		ASSERT_TRUE(test1.size() == 4);
		ASSERT_EQ(test1.getID(), ID1);
		ASSERT_EQ(test1.getSignature(), Signature1);

	}

	/**
	 * Test Set Signature
	 */

	TEST_F( SignatureRegisterTestFixture, RegisterGetAndSetSignature) {

		typedef SignatureRegister<4, PhraseID> Register;

		PhraseID 						ID1(1);
		std::bitset<4> 					Signature1(std::string("0001")), Signature2(std::string("1011"));
		SignatureRegister<4, PhraseID> 	test1(ID1, Signature1);

		test1.setSignature(Signature2);
		ASSERT_EQ(test1.getSignature(), Signature2);

	}

}


#endif /* SLICEREGISTER_GTEST_H_ */
